Portably solving the access(2)/open(2) race

نویسنده

  • Stephen Checkoway
چکیده

The access(2)/open(2) file-system race is the canonical example of a time-of-check-to-time-of-use (TOCTTOU) error in which a setuid binary checks that a user has permission to open a file prior to opening it. By changing the state of the file-system between the calls to access(2) and open(2), an attacker can cause the program to open a file to which the user does not have access. This race has been the focus of several papers alternately trying to defend against the race and attacking the defenses [3, 1, 2]. In this paper, we give a simple solution that avoids the race condition in all POSIX.1-conformant operating systems such as Mac OS X 10.6.8, Linux 2.6.35, FreeBSD 8.2, NetBSD 5.1, OpenBSD 4.9, Dragonfly BSD 2.10.1, and Solaris 10. In other words, most modern, UNIX-like operating systems. Dean and Hu explicitly reject a solution based on temporarily changing user ids writing, “a solution depending on user id juggling can be made to work, but is generally not portable” [3]. This may have been true in 2004, but is no longer the case today as all modern UNIX-like operating systems correctly implement the seteuid(2)/setegid(2) system calls—note the ‘e’ for “effective.” Rather than testing if a file can be opened and then opening it, a secure setuid program should use seteuid(2)/setegid(2) and simply open(2) the file. If the open(2) call fails with errno set to EPERM, then the user/group did not have permission to open the file. If the call succeeds, then the user/group had permission. BODY access(2)/open(2) file-system races can be prevented by omitting access(2) and using seteuid(2)/setegid(2) before open(2) on a modern OS.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Portably Solving File TOCTTOU Races with Hardness Amplification

The file-system API of contemporary systems makes programs vulnerable to TOCTTOU (time of check to time of use) race conditions. Existing solutions either help users to detect these problems (by pinpointing their locations in the code), or prevent the problem altogether (by modifying the kernel or its API). The latter alternative is not prevalent, and the former is just the first step: programm...

متن کامل

Fixing Races for Fun and Profit: How to Abuse atime

Dean and Hu proposed a probabilistic countermeasure to the classic access(2)/open(2) TOCTTOU race condition in privileged Unix programs [4]. In this paper, we describe an attack that succeeds with very high probability against their countermeasure. We then consider a stronger randomized variant of their defense and show that it, too, is broken. We conclude that access(2) must never be used in p...

متن کامل

Fixing Races for Fun and Profit: How to Use access(2)

It is well known that it is insecure to use the access(2) system call in a setuid program to test for the ability of the program’s executor to access a file before opening said file. Although the access(2) call appears to have been designed exactly for this use, such use is vulnerable to a race condition. This race condition is a classic example of a time-of-check-to-time-of-use (TOCTTOU) probl...

متن کامل

بررسی میزان آشنایی و نگرش اعضای هیات علمی نسبت به جنبش دسترسی آزاد به اطلاعات علمی در دانشگاه علوم پزشکی تهران

Background and Aim: Open access to scientific information is a new paradigm in scientific communication that facilitates access to research. This study was carried out to identify Tehran University of medical science faculties members’ familiarities with Open access and to survey their attitude about it. Materials and Methods: A descriptive survey method was applied. The study population consis...

متن کامل

An imperialist competitive algorithm for solving the production scheduling problem in open pit mine

Production scheduling (planning) of an open-pit mine is the procedure during which the rock blocks are assigned to different production periods in a way that the highest net present value of the project achieved subject to operational constraints. The paper introduces a new and computationally less expensive meta-heuristic technique known as imperialist competitive algorithm (ICA) for long-term...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • TinyToCS

دوره 1  شماره 

صفحات  -

تاریخ انتشار 2012